package com.xxl.job.admin.core.conf;

import com.google.common.eventbus.AsyncEventBus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * description:
 * <p>
 * Date: 2018/12/26
 * <p>
 * Time: 19:51
 *
 * @author zhangxin
 */
@Configuration
public class EventBusFactory {

    public static final String JOB_INFO_BATCH_ADD_START_BEAN_NAME = "jobInfoBatchAddStartEventBus";

    @Autowired
    private JobInfoBatchAddStartExecutor jobInfoBatchAddStartExecutor;

    @Bean(name = JOB_INFO_BATCH_ADD_START_BEAN_NAME)
    public AsyncEventBus dbEventBus(){
        AsyncEventBus eventBus = new AsyncEventBus(jobInfoBatchAddStartExecutor.getExecutor());
        return eventBus;
    }
}
